package com.eastfair.venueservice.dao;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.eastfair.boot.mapper.SuperMapper;
import com.eastfair.venueservice.dto.ServiceInventoryQuery;
import com.eastfair.venueservice.entity.ServiceInventory;

import com.eastfair.venueservice.vo.ServiceInventoryVO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * Mapper 接口
 * 服务库存
 * </p>
 *
 * @author linan
 * @date 2022-07-14
 */
@Repository
public interface ServiceInventoryMapper extends SuperMapper<ServiceInventory> {

    /**
     * 增加库存数量
     * @param inventoryCode
     * @param inNum
     */
    void addInventory(@Param("inventoryCode") String inventoryCode, @Param("inNum")  BigDecimal inNum);

    /**
     * 减少库存数量
     * @param inventoryCode
     * @param outNum
     */
    void minusInventory(@Param("inventoryCode") String inventoryCode,@Param("outNum") BigDecimal outNum);

    /**
     * 查询库存列表
     * @param serviceInventoryQueryPage
     * @param wrapper
     * @return
     */
    Page<ServiceInventoryVO> queryInventoryList(Page<ServiceInventoryQuery> serviceInventoryQueryPage, @Param(Constants.WRAPPER)QueryWrapper<ServiceInventory> wrapper);

    /**
     * 查询库存统计
     * @return
     * @param serviceInventoryQuery
     */
    List<Map<String, Object>> queryInventoryStatistics(ServiceInventoryQuery serviceInventoryQuery);

    /**
     * 出入库数量趋势
     * @param serviceInventoryQuery
     * @return
     */
    List<Map<String, Object>> inOutTrend(ServiceInventoryQuery serviceInventoryQuery);

    /**
     * 库存商品类型数量
     * @param serviceInventoryQuery
     * @return
     */
    List<Map<String, Object>> inventoryTypeNum(ServiceInventoryQuery serviceInventoryQuery);

    /**
     * 出库类型数量
     * @param serviceInventoryQuery
     * @return
     */
    List<Map<String, Object>> inventoryTypeOfOut(ServiceInventoryQuery serviceInventoryQuery);

    /**
     * 入库类型数量
     * @param serviceInventoryQuery
     * @return
     */
    List<Map<String, Object>> inventoryTypeOfIn(ServiceInventoryQuery serviceInventoryQuery);

    /**
     * 查询需要告警的服务规格项
     * @param exhibitionManageId
     * @return
     */
    List<ServiceInventoryVO> queryWaringItem(@Param("exhibitionManageId") Long exhibitionManageId);
}
